﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="/static/css/angularStyle.css" />
    <link rel="stylesheet" href="/static/css/common/reset.css" />
    <link rel="stylesheet" href="/static/css/associate.css" />
    <link rel="stylesheet" href="/static/css/sweetalert.min.css" />
    <link rel="stylesheet" href="/static/css/ng-pagination.min.css" />
    <title>宾果高校</title>
</head>
<body>
    <div class="associate">
        <div id="divHeader"></div>
        <section class="assoc-content container clearfix">
            <div class="assoc-c-left fl">

                <div id="divNavigation"></div>
            </div>
            <div class="assoc-c-right fr" ng-app="myApp">
                <div class="assoc-cr-underActivity mt40" ng-controller="collectionCtrl">
                    <p class="f14">我的收藏</p>
                    <table class="assoc-cru-content mt20">
                        <thead class="assoc-cru-list mt5 borderbtm">
                            <tr>
                                <th class="">活动名称</th>
                                <th>发布时间</th>
                                <!--<th>活动被收藏次数</th>-->
                                <!--<th>浏览次数</th>-->
                                <th id="pInvite">社团邀请</th>
                                <th id="pAmount">提供赞助金</th>
                                <th>查看详情</th>
                                <th>活动状态</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody class="assoc-cruc-tab" ng-cloak>
                            <tr class="assoc-cru-list clearfix" ng-repeat="x in names">
                                <td>{{x.ProjectName}}</td>
                                <td>{{x.CreateDate}}</td>
                                <!--<p>3</p>-->
                                <!--<p>3</p>-->
                                <td>{{x.ContractNumber}}</td>
                                <td>{{x.Amount}}</td>
                                <td><a href="/release-detail.html?id={{x.ProjectID}}" class="assoc-crul-check">点击查看</a></td>
                                <td>{{x.Status | projectStatus}}</td>
                                <td><a onclick="Remove(this)" tag="{{x.ProjectID}}" href="javascript:void(0)" class="assoc-crul-delete ml30"></a></td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="page">
                        <div class="center">
                            <pager page-count="pageCount" current-page="currentPage" on-page-change="onPageChange()" first-text="首页" next-text="下一页" prev-text="上一页" last-text="尾页"></pager>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <div id="divFooter"></div>
</body>
</html>

<script type="text/javascript" src="/static/js/ref/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/js/self/common.js"></script>
<script type="text/javascript" src="/static/js/ref/angular.min.js"></script>
<script type="text/javascript" src="/static/js/ref/sweetalert.min.js"></script>
<script type="text/javascript" src="/static/js/ref/ng-pagination.min.js"></script>
<script>

    var userType = common.GetUserType();
    if (!common.checkValue(userType))
        window.location = "/index.html";

    $("#divHeader").load("/wuc/header.html");
    $("#divFooter").load("/wuc/footer.html");
    $("#divNavigation").load("/wuc/navigation.html");

    switch (userType) {
        case 2:
            $("#pInvite").html("企业邀请");
            $("#pAmount").html("所需赞助金");
            break;
        case 3:
            $("#pInvite").html("所属社团");
            $("#pAmount").html("所需赞助金");
            break;
    }

    function Remove(obj) {

        var id = $(obj).attr("tag");

        common.commonAjax({ type: 'Get', url: '/api/project/RemoveFavorites?id=' + id, sMethod: AfterCompleted, alert: true });
    }

    function AfterCompleted(ctx) {

        if (ctx == null) {
            common.alertMessage("无数据.");
            return;
        }

        window.location = "sponsor.html";
    }

    var app = angular.module('myApp', ['projectStatusFilters', 'ng-pagination']);

    angular.module('projectStatusFilters', []).filter('projectStatus', function () {
        return function (input) {
            switch (input) {
                case 'Overdue':
                    return "已过期";
                case 'Started':
                    return "已开始";
                case 'Cancelled':
                    return "已取消";
                case 'Closed':
                    return "已结束";
                case 'Open':
                    return "赞助中";
            }
        };
    });

    common.CreatePagingCtrl({ name: 'collectionCtrl', url: '/api/project/ListProjectCollection', limit: 10, app: app });

</script>
